import { rawRequestClient } from '#/api/request';

// 权限策略接口类型定义
export interface PermissionPolicy {
  subject: string;
  object: string;
  action: string;
}

// 获取权限策略列表
export function getPermissionPolicies() {
  return rawRequestClient.get(`${import.meta.env.VITE_AUTH_SERVER}/permissions/policies`);
}

// 添加权限策略
export function addPermissionPolicies(policies: PermissionPolicy[]) {
  return rawRequestClient.post(`${import.meta.env.VITE_AUTH_SERVER}/permissions/policies`, policies);
}

// 删除权限策略
export function deletePermissionPolicies(policies: PermissionPolicy[]) {
  return rawRequestClient.delete(`${import.meta.env.VITE_AUTH_SERVER}/permissions/policies`, { data: policies });
}
